package hk.security;
import java.io.IOException;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.*;

public class AccDeniedHandler implements AccessDeniedHandler {
	@Override
	public void handle(HttpServletRequest request, HttpServletResponse response,
			AccessDeniedException accessDeniedException) throws IOException, ServletException {
		response.setContentType("text/html;charset=utf-8");
		response.getWriter().print("没有权限,当前url"+request.getRequestURI()+" 拒绝: " + accessDeniedException.getLocalizedMessage());
	}

}
